/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package com.bio.jpa.entities;

import com.bio.jsf.FastaController;
import java.io.IOException;
import java.io.Serializable;
import java.io.StringReader;
import java.util.logging.Level;
import java.util.logging.Logger;
import javax.persistence.Basic;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.Lob;
import javax.persistence.ManyToOne;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.Table;
import javax.persistence.Transient;
import javax.validation.constraints.Size;
import javax.xml.bind.annotation.XmlRootElement;

/**
 *
 * @author Diego
 */
@Entity
@Table(name = "fasta_sequence")
@XmlRootElement
@NamedQueries({
    @NamedQuery(name = "FastaSequence.findAll", query = "SELECT f FROM FastaSequence f"),
    @NamedQuery(name = "FastaSequence.findByIdSequence", query = "SELECT f FROM FastaSequence f WHERE f.idSequence = :idSequence"),
    @NamedQuery(name = "FastaSequence.findByRawSeq", query = "SELECT f FROM FastaSequence f WHERE f.rawSeq = :rawSeq")})
public class FastaSequence implements Serializable {

    private static final long serialVersionUID = 1L;
    @Id
    @GeneratedValue(strategy = GenerationType.SEQUENCE)
    @Basic(optional = false)
    @Column(name = "id_sequence")
    private Integer idSequence;
    @Lob
    @Size(max = 2147483647)
    @Column(name = "seq")
    private String seq;
    @Column(name = "raw_seq")
    private Integer rawSeq;
    @JoinColumn(name = "fasta_id", referencedColumnName = "fasta_id")
    @ManyToOne(optional = false)
    private Fasta fasta;

    public FastaSequence() {
    }

    public FastaSequence(String seq, Integer rawSeq, Fasta fasta) {
        this.seq = seq;
        this.rawSeq = rawSeq;
        this.fasta = fasta;
    }

    public FastaSequence(Integer idSequence) {
        this.idSequence = idSequence;
    }

    public Integer getIdSequence() {
        return idSequence;
    }

    public void setIdSequence(Integer idSequence) {
        this.idSequence = idSequence;
    }

    public String getSeq() {
        return seq;
    }

    public void setSeq(String seq) {
        this.seq = seq;
    }

    public Integer getRawSeq() {
        return rawSeq;
    }

    public void setRawSeq(Integer rawSeq) {
        this.rawSeq = rawSeq;
    }

    public Fasta getFastaId() {
        return fasta;
    }

    public void setFastaId(Fasta fastaId) {
        this.fasta = fastaId;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (idSequence != null ? idSequence.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof FastaSequence)) {
            return false;
        }
        FastaSequence other = (FastaSequence) object;
        if ((this.idSequence == null && other.idSequence != null) || (this.idSequence != null && !this.idSequence.equals(other.idSequence))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "com.bio.jpa.entities.FastaSequence[ idSequence=" + idSequence + " ]";
    }
}
